<?php
/**
 * 
 */

namespace App\Common\Server;

use App\Common as com;
use App as nameApp;

class Base extends com\Cla\ClaBase {

	/**
	 * 单数据||多数据获取
	 * @param int $id
	 * @param array $ids
	 * @param \Closure $callback
	 * @param string $idsResFieldName
	 * @return array[]|mixed
	 */
	protected function getDataIds( int $id, array $ids, \Closure $callback, string $idsResFieldName = 'lists' ) {
		$datas = [];
		//
		$dataIds = $id !== null ? [ $id ] : $ids;
		foreach( $dataIds as $dataId ){
			$dataIds[ $dataId ] = $callback( $dataId );
		}
		if( $id !== null ){
			return reset( $datas );
		}else{
			return [ $idsResFieldName => $datas ];
		}
	}

}
